let navs1 = [
    {title: '家电馆', href: 'https://jiadian.jd.com/'},
    {title: '家电专卖店', href: 'https://pro.jd.com/mall/active/6fboBT3QVrMUPHRh9kxKXPsz7bc/index.html'},
    {title: '家电服务', href: 'https://pro.jd.com/mall/active/3Fy6fJbih9wXySuLJjZAKBiVNMje/index.html'},
    {title: '企业采购', href: 'https://jdqc.jd.com/'},
    {title: '商用电器', href: 'https://list.jd.com/list.html?cat=737,14857'},
    {title: '高价回收', href: 'https://pro.jd.com/mall/active/vgdjc9m4qW1t5qrx4aQceh5sbbb/index.html'}
]

let navs2 = [
    {
        title: "电视",
        children: [
            {title: '全面屏电视', href: 'https://jiadian.jd.com/'},
            {title: '教育电视', href: 'https://pro.jd.com/mall/active/6fboBT3QVrMUPHRh9kxKXPsz7bc/index.html'},
            {title: 'OLED电视', href: 'https://pro.jd.com/mall/active/3Fy6fJbih9wXySuLJjZAKBiVNMje/index.html'},
            {title: '智慧屏', href: 'https://jdqc.jd.com/'},
            {title: '4K超清电视', href: 'https://list.jd.com/list.html?cat=737,14857'},
            {title: '55英寸', href: 'https://pro.jd.com/mall/active/vgdjc9m4qW1t5qrx4aQceh5sbbb/index.html'},
            {title: '电视配件', href: 'https://pro.jd.com/mall/active/vgdjc9m4qW1t5qrx4aQceh5sbbb/index.html'}
        ]
    },
    {
        title: "空调",
        children: [
            {title: '新风空调', href: 'https://jiadian.jd.com/'},
            {title: '以旧换新', href: 'https://pro.jd.com/mall/active/6fboBT3QVrMUPHRh9kxKXPsz7bc/index.html'},
            {title: '空调挂机', href: 'https://pro.jd.com/mall/active/3Fy6fJbih9wXySuLJjZAKBiVNMje/index.html'},
            {title: '空调柜机', href: 'https://jdqc.jd.com/'},
            {title: '空调套装', href: 'https://list.jd.com/list.html?cat=737,14857'},
            {title: '新一级能效', href: 'https://pro.jd.com/mall/active/vgdjc9m4qW1t5qrx4aQceh5sbbb/index.html'}
        ]
    }
]

let nav3 = [
    {
        href: "https://pro.jd.com/mall/active/3BPQ3jZhu2VtDQA83UHDSVpbkQbK/index.html",
        src: "https://img14.360buyimg.com/vclist/s166x70_jfs/t1/90641/24/3606/1171/5de0e340Eaad1e3e0/5b9cad64436c05ff.jpg.webp"
    },
    {
        href: "https://https//pro.jd.com/mall/active/2uGNsSm1NaEuri7y5g4ocYHTz4qW/index.html",
        src: "https://img13.360buyimg.com/vclist/s166x70_jfs/t1/139430/40/24916/4442/61c9306fE31c9f3c2/1512a1c385847911.jpg.webp"
    },
    {
        href: "https://pro.jd.com/mall/active/x4jSkhDjgv6YzZnwZWo4rBNDTRx/index.html",
        src: "https://img11.360buyimg.com/vclist/s166x70_jfs/t3211/96/3882705424/5364/76e60d4a/57f9fa89N6ddb14fc.jpg.webp"
    },
    {
        href: "https://mall.jd.com/index-1000003445.html",
        src: "https://img13.360buyimg.com/vclist/s166x70_jfs/t2587/271/1840897889/3013/d15dee81/574c0755Nc8f19944.jpg.webp"
    },
    {
        href: "https://pro.jd.com/mall/active/4ShPRvH8fJd3FhXsm1QPR69SAjHE/index.html",
        src: "https://img13.360buyimg.com/vclist/s166x70_jfs/t1/137612/20/16799/13456/5fc8514aEdf8dc1d2/3934e33362f22489.jpg.webp"
    },
    {
        href: "https://mall.jd.com/index-1000002989.html",
        src: "https://img12.360buyimg.com/vclist/s166x70_jfs/t1/20167/31/8667/2542/5c7899aeE5a38be51/890312111d77e347.jpg.webp"
    },
    {
        href: "https://mall.jd.com/index-1000001095.html",
        src: "https://img12.360buyimg.com/vclist/s166x70_jfs/t1/18168/12/13678/6403/5ca17568E9e98402d/823e24e3a2acd047.jpg.webp"
    },
    {
        href: "https://mall.jd.com/index-1000000950.html?from=pc",
        src: "https://img11.360buyimg.com/vclist/s166x70_jfs/t1/106502/32/20236/4442/61c93037Ec1115380/2407c9292c6bb419.jpg.webp"
    }
]

let nav4 = [
    {
        href: "https://pro.jd.com/mall/active/3BPQ3jZhu2VtDQA83UHDSVpbkQbK/index.html",
        src: "https://img14.360buyimg.com/vclist/s166x70_jfs/t1/90641/24/3606/1171/5de0e340Eaad1e3e0/5b9cad64436c05ff.jpg.webp"
    },
    {
        href: "https://https//pro.jd.com/mall/active/2uGNsSm1NaEuri7y5g4ocYHTz4qW/index.html",
        src: "https://img13.360buyimg.com/vclist/s166x70_jfs/t1/139430/40/24916/4442/61c9306fE31c9f3c2/1512a1c385847911.jpg.webp"
    },
]


const createNavs1 = navs => navs.reduce((prev, cur) => prev + `<div className="nav-item"><a href="${cur.href}">${cur.title} ></a></div>`, '')

const createNavs2 = navs => navs.reduce((prev, cur) => prev + `
    <div class="detail-item">
        <div class="detail-title">${cur.title} ></div>
        <div class="detail-list">${cur.children.map(item => `<a href="${item.href}">${item.title}</a>`).join('')}</div>
    </div>
`, '')

const createNavs3 = navs => navs.reduce((prev, cur) => prev + `
    <a href="${cur.href}">
        <img src="${cur.src}" alt="">
    </a>
`, '')


$("li.silder-menu-item").mouseenter(function (e) {
    // 获取数据 填充进去就好了
    const index = $(this).index()
    $(".hover-content").css('display', 'flex')
    $('.navs').html(index + createNavs1(navs1))
    $('.navs-detail').html(createNavs2(navs2))
    $('.enterprise-list').html(createNavs3(nav3))
    $('.enterprise-img').html(createNavs3(nav4))
}).mouseleave(function () {
    $(".hover-content").hide()
})